package org.example.servcie;

import org.example.dao.UserDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component //加注解@Component=@Repository(数据库有关操作)=@Service(加在Service类上)=@Controller(控制层上)
public class UserService {
    @Autowired  //spring自动注入成员变量 省略set get方法
    private UserDao userDao;

    public UserDao getUserDao() {
        return userDao;
    }

    public void setUserDao(UserDao userDao) {
        this.userDao = userDao;
    }

    public String getName(){
        return userDao.getName();
    }
}
